<template>
  <div class="newsinfo">
    <div class="header">
      <span class="title">{{ newsinfo.zhaiyao }}</span>
      <span class="clicknum">阅读{{ newsinfo.click }}</span>
    </div>
    <p class="conntent">{{ newsinfo.content }}</p>
    <comment :id="id"></comment>
  </div>
</template>
<script>
import comment from '../../../../components/comment'
export default {
  props: {
    newsID: {
      type: String
    }
  },
  data: () => ({
    newsinfo: {},
    id: ''
  }),
  methods: {
    async getNewsInfo() {
      const res = await this.$http.getNewsInfo(this.newsID)
      this.newsinfo = res.data.message
    }
  },
  created() {
    this.getNewsInfo()
    this.id = this.newsID
  },
  components: {
    comment
  }
}
</script>
<style lang="scss" >
.newsinfo {
  padding: 15px;
  .header {
    margin-bottom: 20px;
    height: 10px;
    .title {
      float: left;
      font-size: 14px;
      font-weight: bold;
    }
    .clicknum {
      float: right;
      font-size: 12px;
      line-height: 25px;
      color: #666;
    }
  }
  .conntent {
    font-size: 14px;
  }
}
</style>
